<% time = "" %>
<div class=page_head>
<h2><%="Listing files".t%></h2>
</div>

<%if @files.size == 0%>
 <div class=tour> 
   <h2><%=link_to "Post the first file for this project".t,new_file_url(params[:project_id])%></h2>
   <%="Share files easy in your project. You can upload big files with uploading clue. It's very easy!".t%>
 </div>
 <%=feature'file'%>
<%end%>

<% for file in @files %>
<div class=file_item>
<% if file.created_at.strftime('%b/%d/%Y %A').upcase.to_s != time.to_s 
      time = file.created_at.strftime('%b/%d/%Y %A').upcase 
%>
<div style="height:20px;">
   <%=time_flag(file.created_at)%> 
</div>
<%end%>
<span class=file_item_icon><%=icon file.content_type.to_s%></span>
    <div class=up_item>
    <%=link_to file.name,"/files/#{file.project.id}/"+file.name%> (<%=file.content_type%>) <%=number_to_human_size(file.size)%> <%="in".t%> 
    <%=link_to file.category.name,project_file_in_category_url(@project.id,file.category.id) rescue link_to "uncategorized".t,project_file_in_category_url(@project.id,'uncat')%>
    <%= link_to image_tag("trash.gif",:border=>0), file_path(@project.id,file), :confirm => 'Are you sure?'.t, :method => :delete %>
    <br/>
    </div>
    <div class=down_item>
    By <%=h file.user.name%> <%="in Message:".t + link_to(file.message.name,message_url(file.message.project,file.message)) if file.message%>
    </div>
</div>
<% end %>

<div class="float_right page">
  <%if @file_pages.length > 1%>
   Pages:
  <%end%>
  <% if params[:category_id] %>
   <%=pagination_links @file_pages,:params=>{:controller=>'redirect',:url=> project_file_in_category_url(params[:project_id],params[:category_id])}%>
  <%else%>
    <%= link_to '<<', files_path(params[:project_id]) + "?page=" + @file_pages.current.previous.to_i.to_s if @file_pages.current.previous %>
   <%=pagination_links @file_pages%>
    <%= link_to '>>', files_path(params[:project_id]) + "?page=" + @file_pages.current.next.to_i.to_s if @file_pages.current.next%>
  <%end%>
</div>

